{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "76505b91-6f7c-40e4-ad41-1a15fc9f7fcd",
   "metadata": {},
   "source": [
    "# 实验一"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "a5a97800-6d27-4dd8-9dd9-3b782be6a1dd",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "de642dda-c9b8-4399-9f5f-96fb1b14578f",
   "metadata": {},
   "source": [
    "## 使用数组比较运算对超市牛奶价格进行对比"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "f6f08ed6-3394-4595-888f-09a6d2db3023",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([19.9, 25. , 29.9, 45. , 39.9])"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "milk_a = np.array([19.9,25,29.9,45,39.9])\n",
    "milk_a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "b959ea14-bb25-4960-a17c-d1a538874ee2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([18.9, 25. , 24.9, 49. , 35.9])"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "milk_b = np.array([18.9,25,24.9,49,35.9])\n",
    "milk_b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "f2346231-9cb0-4ffd-8d95-f6e5fef4aaa9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ True, False,  True, False,  True])"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "res = milk_a > milk_b\n",
    "res"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "df3c5802-bc78-4932-b44c-1628a70ecccc",
   "metadata": {},
   "source": [
    "## 创建6*6的简单数独游戏矩阵"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "e8edc6d8-f880-4f4c-814a-72da522bf06f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0, 0, 0, 0, 0, 0],\n",
       "       [0, 0, 0, 0, 0, 0],\n",
       "       [0, 0, 0, 0, 0, 0],\n",
       "       [0, 0, 0, 0, 0, 0],\n",
       "       [0, 0, 0, 0, 0, 0],\n",
       "       [0, 0, 0, 0, 0, 0]])"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = np.zeros((6, 6), dtype=int)\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "3db76e33-fbf6-4b83-9a8d-2a559f12c64c",
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in range(6):\n",
    "    a[i] = np.roll([1, 2, 3, 4, 5, 6], -i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "ced8d505-1f76-428b-b90d-06accbe89ad3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 2, 3, 4, 5, 6],\n",
       "       [2, 3, 4, 5, 6, 1],\n",
       "       [3, 4, 5, 6, 1, 2],\n",
       "       [4, 5, 6, 1, 2, 3],\n",
       "       [5, 6, 1, 2, 3, 4],\n",
       "       [6, 1, 2, 3, 4, 5]])"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f32a936e-b214-43f3-bb20-0e6a13b66027",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6a3cca16-f1a7-4ea3-b74c-0cfb015f3b0c",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4aaffbe0-cd97-4423-9bcc-443e5612529e",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d4e06194-2db0-4a1d-9783-fa801ac20633",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.20"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
